function mTab =Net_taskGeneration(netDefinitionMatrix, taskNr,minExecTime,maxExecTime)
%NET_TASKGENERATION Summary of this function goes here
%   Detailed explanation goes here

machineNr = size(netDefinitionMatrix,1);
mTab = zeros(machineNr,machineNr,taskNr);
    
for i=1:taskNr
    taskMatrix = zeros(machineNr,machineNr);
    busyMachinesNumbers = zeros(1,machineNr);
    for j=1:machineNr
        machineNrVector = find(netDefinitionMatrix(j,:)~=0);
        for k=1:length(busyMachinesNumbers)
            if busyMachinesNumbers(k) ~= 0
                machineNrVector(machineNrVector==busyMachinesNumbers(k)) = [];
            end
        end
        
        if ~isempty(machineNrVector)
            selectedMachinePos = randi([1,length(machineNrVector)]);
            if selectedMachinePos > 0
                selectedMachineNr = machineNrVector(1,selectedMachinePos);
                firstEmptyNr = find(busyMachinesNumbers==0,1);
                busyMachinesNumbers(1,firstEmptyNr) = selectedMachineNr;
                taskMatrix(j, selectedMachineNr) = randi([minExecTime,maxExecTime]);
            end  
        end
    end
    mTab(:,:,i) = taskMatrix; 
end
clearvars taskNr machineNr minExecTime maxExecTime taskMatrix machineNrVector execOrder i j pickMachine
end

